<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="title">
            <h:outputText value="Master Production Schedules (Daily)"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:form prependId="false">
                <p:panel header="Master Production Schedules (Daily)">
                <h:panelGroup rendered="#{masterProductionScheduleDailyEntityController.items.rowCount > 0}">
                    <p:dataTable value="#{masterProductionScheduleDailyEntityController.items}" 
                                     var="item" style="table-layout:fixed"
                                     paginator="true" rows="10"
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="5,10,15">
                        
                        <p:column style="width:16px">  
                                <p:rowToggler />  
                        </p:column>
                        
                        <p:column filterBy="#{item.dayofProduction}">
                            <f:facet name="header">
                                <h:outputText value="Day"/>
                            </f:facet>
                            <h:outputText value="#{item.dayofProduction}"/>
                        </p:column>
                        <p:column filterBy="#{item.mpsMonthly.monthOfProduction}">
                            <f:facet name="header">
                                <h:outputText value="Month"/>
                            </f:facet>
                            <h:outputText value="#{item.mpsMonthly.monthOfProduction}"/>
                        </p:column>
                        <p:column filterBy="#{item.yearOfProduction}">
                            <f:facet name="header">
                                <h:outputText value="Year"/>
                            </f:facet>
                            <h:outputText value="#{item.yearOfProduction}"/>
                        </p:column>
                        <p:column filterBy="#{item.productionType}">
                            <f:facet name="header">
                                <h:outputText value="Production Line"/>
                            </f:facet>
                            <h:outputText value="#{item.productionType}"/>
                        </p:column>
                        <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:commandButton image="ui-icon ui-icon-search" action="#{masterProductionScheduleDailyEntityController.prepareView}" ajax="false"/>
                        </p:column>
                        <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:commandButton image="ui-icon ui-icon-pencil" action="#{masterProductionScheduleDailyEntityController.prepareEdit}" ajax="false"/>
                        </p:column>
                        <p:rowExpansion>  
                                <h:panelGrid columns="1">
                                    <p:dataTable value="#{item.breakdownByProduct}" 
                                                 var="ppq" style="table-layout:fixed"
                                                 rows="6" >

                                        <f:facet name="header">  
                                            <h:outputText value="Production Breakdown"/>
                                        </f:facet>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="Product"/>
                                            </f:facet>
                                            <h:outputText value="#{ppq.product.productName}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="Quantity Per Day"/>
                                            </f:facet>
                                            <h:outputText id="output" value="#{ppq.quantity}"/>
                                        </p:column>
                                    </p:dataTable>
                                </h:panelGrid>
                            </p:rowExpansion>
                    </p:dataTable>
                </h:panelGroup>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
